package cc.mrbird.unit.service.impl;

import cc.mrbird.common.service.impl.BaseService;
import cc.mrbird.unit.domain.UserUnit;
import cc.mrbird.unit.service.UserUnitService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Arrays;
import java.util.List;
@Service("userUnitService")
public class UserUnitServiceImpl extends BaseService<UserUnit> implements UserUnitService {
    @Override
    @Transactional
    public void deleteUserUnitByUserId(String userId) {
        List<String> list = Arrays.asList(userId.split(","));
        this.batchDelete(list, "user_id", UserUnit.class);
    }

    @Override
    @Transactional
    public void deleteUserUnitByUnitId(String unitId) {
        List<String> list = Arrays.asList(unitId.split(","));
        this.batchDelete(list, "unit_id", UserUnit.class);
    }
}
